import requests
from bs4 import BeautifulSoup

urls = [
    f'https://www.cnblogs.com/#p{page}'
    for page in range(1, 20 + 1)
]

def crawl(url):
    r = requests.get(url)
    # print(url)
    return r.text

def parse(html):
    soup = BeautifulSoup(html, 'html.parser')
    links = soup.find_all('a', {'class': 'post-item-title'})
    return [(link['href'], link.get_text()) for link in links]

if __name__ == '__main__':
    html = crawl(urls[0])
    results = parse(html)
    for result in results:
        print(result)

